<?php
// NOTE: This file cannot be used from inside a .htaccess protected directory.
// If you are getting "Forbidden" errors when trying to use this file, this
// is probably the cause.  You must do one of 2 things to use this file:
//
// 1 - Disable .htaccess authentication -- FOR TESTING ONLY
//
// 2 - Copy this file and the xmlrpcutils subdirectory somewhere else and test
//     from there

include("../config.php");
include("xmlrpcutils/utils.php");
include("../xmlrpc/lib.php");
@ raise_memory_limit("192M"); //fonction de lib/setuplib.php incluse via config.php

$host = $CFG->dbhost;
$port = 80;
$uri = $CFG->wwwroot."/xmlrpc/xmlrpc.php";
require_once ($CFG->libdir . '/ddllib.php');
$test=install_from_xmldb_file($CFG->dirroot . '/xmlrpc/db/install.xml');
// By default, just call Ping
$method = "Ping";

/* Example to create a new user account 
$method = "CreateAccount";
$m_user['username']='testuser';
$m_user['firstname']='John';
$m_user['lastname']='-Doe';
$m_user['email']='johndoe@mydomain.com';
$m_user['maildisplay']=2;
$m_user['mailformat'] = 1;
$m_user['autosubscribe'] = 1;
$m_user['htmleditor'] = 1;
$m_user['city'] = "None";
$m_user['country'] = "US";
$m_user['lang'] = "en";
$m_user['timezone'] = 99;
$m_user['description'] = "";
$m_user['url'] = "";
$m_user['icq'] = "";
$m_user['idnumber'] = "";
$m_user['institution'] = "";
$m_user['department'] = "";
$m_user['phone1'] = "";
$m_user['phone2'] = "";
$m_user['address'] = "";
$m_user['picture'] = "";
$m_user['timemodified'] = time();
$m_user['password'] = md5('password');
$m_user['confirmed']=1;
$m_user['mnethostid']=1;

//End create user example */

$callspec = array(
'method' => $method,
'host' => $host,
'port' => $port,
'uri' => $uri,
'user' => 'admin',
'pass' => 'Yerson66&&',
'secure' => false,
'debug' => true,
'args' => $m_user);

$result = xu_rpc_http_concise($callspec);

print_r($result);

?>
